"""
管理后台 - 文件上传接口
"""
from fastapi import APIRouter, Depends, UploadFile, File
from app.dependencies import get_current_user
from app.schemas.common import ResponseModel
from app.utils.oss import upload_image_to_oss


router = APIRouter()


@router.post("/image", response_model=ResponseModel)
async def upload_image(
    file: UploadFile = File(...),
    current_user = Depends(get_current_user)
):
    """
    上传图片到OSS
    """
    image_url = await upload_image_to_oss(file)
    
    return ResponseModel(
        code=200,
        message="上传成功",
        data={"url": image_url}
    )

